<template>
	<Template :groups="groups" :templates="templates" :i_class="i_class"></Template>
</template>

<script>
import {getAPItokenRes} from '@/utils/api'
import Template from './template'
export default {
	components: {
		Template
	},
	data () {
		return {
			groups: [],
			templates: [],
			i_class: 'fa fa-3x fa-address-book-o badge-info'
		}
	},
	methods: {
		getGroups () {
			const promise = getAPItokenRes(API.sysGroup+'?type=人员',this.token)
			promise.then((res)=>{
				if (res.status == 200) {
					this.groups = res.data
				}
			})
		},
		getTemplates () {
			const promise = getAPItokenRes(API.sysTemp+'?group_by=group.type',this.token)
			promise.then((res)=>{
				if (res.status == 200) {
					this.templates = res.data['人员']
				}
			})
		}
	},
	mounted () {
		this.token = this.$store.state.user.token
		this.getGroups()
		this.getTemplates()
	}
}
</script>

<style scoped>
</style>